package com.toe.recommend.webapi.controller;


import com.toe.common.restful.JsonResult;
import com.toe.pojo.vo.recommend.RecommendBusinessVO;
import com.toe.recommend.service.RecommendBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 陶涛
 * @since 2022-07-19
 */
@RestController
@RequestMapping("/recommend-business")
@Api(tags = "推荐商家模块")
public class RecommendBusinessController {

    @Autowired
    RecommendBusinessService recommendBusinessService;

    @GetMapping("/by-distance")
    @ApiOperation("获取附近商家")
    @ApiImplicitParam(value = "自身位置", name = "location", required = true,
            dataType = "string", example = "102.735068,25.051400")
    public JsonResult<List<RecommendBusinessVO>> getBusinessByDistance(
            String location) {
        return JsonResult.ok(
                recommendBusinessService.recommendBusiness(location));
    }

}

